package com.gw2.gw2world.web.server;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
public class PageController {
	/*@RequestMapping(value = "/home", method=RequestMethod.GET)
	public String launchHome() {return "home";} //will use /WEB-INF/jsp/home.jsp
	@RequestMapping(value = "/active", method=RequestMethod.GET)
	public String launchActiveEvents() {return "activeEvent";}
	@RequestMapping(value = "/world", method=RequestMethod.GET)
	public String launchWorldEvents() {return "worldEvent";}
	@RequestMapping(value = "/items", method=RequestMethod.GET)
	public String launchItems() {return "items";}
	@RequestMapping(value = "/crafting", method=RequestMethod.GET)
	public String launchCrafting() {return "crafting";}
	@RequestMapping(value = "/signup", method=RequestMethod.GET)
	public String launchSignup() {return "signup";}
	@RequestMapping(value = "/account", method=RequestMethod.GET)
	public String launchAccount() {return "account";}
	@RequestMapping(value = "/server", method=RequestMethod.GET)
	public String launchUserServer() {return "server";}
	@RequestMapping(value = "/contact", method=RequestMethod.GET)
	public String launchContact() {return "contact";}*/
	@RequestMapping(value = "/hello", method=RequestMethod.GET)
	public String launchHello() {
		return "hello";
	}
	
	//JSON queries
	/**
	 * Get event information
	 * 
	 * @param lang Selected language. Values are en, fr, es, de
	 * @param event_id The event ID to query or multiple event ID separated with commas
	 * @param server_id The server ID to query or multiple server ID separated with commas. Limit is 3 (one home and 2 guest)
	 * @param state The event state to query or multiple event states separated with commas
	 * @param map_id The map ID to query or multiple map ID separated with commas
	 * @param detail Additional fields to return (separated with commas): server, state, map, level, group, location, lang
	 * @return JSON data
	 */
	//@RequestMapping(value="/events.json", method = RequestMethod.GET, headers = "Content-Type=application/json; charset=utf-8")
	public String getEvent(
			@RequestParam(value = "lang", required = false, defaultValue = "en") String lang,
			@RequestParam(value = "event_id", required = false) String event_id,
			@RequestParam(value = "world_id", required = false) String server_id,
			@RequestParam(value = "state", required = false) String state,
			@RequestParam(value = "map_id", required = false) String map_id,
			@RequestParam(value = "detail", required = false) String detail) {
		return "[]";
	}

	/** Get guild information: retrieve information from database or from GW2 official API if not found
	 * @param guild_id Find the guild ID.
	 * @param guild_name Find the guild name.
	 * @param tag Find guild tage in database
	 * @param emblem If we should retrieve emblem information
	 * @return JSON data
	 */
	//@RequestMapping(value="/guild.json", method = RequestMethod.GET, headers = "Content-Type=application/json; charset=utf-8")
	public String getGuild(
			@RequestParam(value = "guild_id", required = false) String guild_id,
			@RequestParam(value = "guild_name", required = false) String guild_name,
			@RequestParam(value = "tag", required = false) String tag,
			@RequestParam(value = "emblem", required = false, defaultValue = "false") boolean emblem) {
		return "{}";
	}
	
	//get colors? http://wiki.guildwars2.com/wiki/API:1/colors
	
	/** Get item information
	 * @param lang Selected language. Values are en, fr, es, de
	 * @param item_id The item ID to query or multiple item ID separated with commas
	 * @param type Item type
	 * @param rarity Item rarity
	 * @param level Level: single number or x-y
	 * @param trading If we should retrieve trading data
	 * @return JSON data
	 */
	//@RequestMapping(value="/items.json", method = RequestMethod.GET, headers = "Content-Type=application/json; charset=utf-8")
	public String getItem(
			@RequestParam(value = "lang", required = false, defaultValue = "en") String lang,
			@RequestParam(value = "item_id", required = false) String item_id,
			@RequestParam(value = "type", required = false) String type,
			@RequestParam(value = "rarity", required = false) String rarity,
			@RequestParam(value = "level", required = false) String level,
			@RequestParam(value = "trading", required = false, defaultValue="false") boolean trading) {
		return "[]";
	}
}
